package com.sit.controller;

import com.sit.entity.CompetitionA;
import com.sit.service.CompetitionAService;
import com.sit.vo.DataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class CompetitionAController {

    @Autowired
    private CompetitionAService competitionAService;

    @ResponseBody
    @RequestMapping("/complist")
    public DataVO complist(){

        return competitionAService.findData();
    }

    @ResponseBody
    @RequestMapping("/addComp")
    public boolean addComp(CompetitionA competitionA){
        return competitionAService.addComp(competitionA);
    }

    @ResponseBody
    @RequestMapping("/deleteComp")
    public boolean deleteComp(@RequestParam("cnoA")String cnoA){
       return competitionAService.deleteComp(cnoA);
    }

    @ResponseBody
    @RequestMapping("/updateComp")
    public boolean updateComp(CompetitionA competitionA){
        return competitionAService.updateComp(competitionA);
    }

    @ResponseBody
    @RequestMapping("/searchComp")
    public DataVO searchComp(@RequestParam("cnA")String cnA){

        return competitionAService.searchComp(cnA);
    }
}
